<?php

namespace Common\Model;

use Think\Model;

/**
 * Description of UserModel
 *
 * @author Shangyidong
 */
class UserModel extends Model {

    function get_user_by_token($token) {
        if ($token == "") {
            return null;
        }
        $UserModel = new \Common\Model\UserModel();
        $user = $UserModel->where("token = '" . $token . "'")->find();
//        show_bug($user);
        return $user;
    }

    function get($id) {
        if ($id == null) {
            return null;
        }
        $UserModel = new \Common\Model\UserModel();
        $user = $UserModel->where("id = " . $id)->find();
        if($user != null){
            $user['password'] = "";
        }
        return $user;
    }

}
